PHP] How can I connect to MySQL on wamp server?
Posted
by user294359
on Stack Overflow
See other posts from Stack Overflow
or by user294359
Published on 2010-03-16T23:47:32Z
Indexed on
2010/03/16
23:51 UTC
Read the original article
Hit count: 106
This might be ridiculously easy for you.. but I've been struggling with this for an hour.. :(
<?php
$connect = mysql_connect("localhost:8080", "root", "mypassword");
echo($connect);?>
This is the code that I'm trying to run - you can see that I'm using 8080 as my port number and, of course, I have html codes as well.
However, it gives me the following error msgs whenever I try to open the php file.
====================================================================================
Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in C:\wamp\www\php_sandbox\index.php on line 2
Warning: mysql_connect() [function.mysql-connect]: Error while reading greeting packet. PID=4932 in C:\wamp\www\php_sandbox\index.php on line 2
Warning: mysql_connect() [function.mysql-connect]: MySQL server has gone away in C:\wamp\www\php_sandbox\index.php on line 2
=====================================================================================
I don't know... what's wrong with this. Is it because of the port number?
© Stack Overflow or respective owner